<template>
  <div>
    <cus-modal ref="modal" width="600" title="未提报单位：">
      <Table border :loading="loading" :columns="columns" :data="data"> </Table>
      <div style="width: 100%; display: flex; justify-content: flex-end">
          <cus-page
            :data="pages"
            class="mt_20"
            @pageChange="postPurchasingPlansNone()"
            simple 
          ></cus-page>
        </div>
      <div slot="footer">
        <slot name="footer">
        </slot>
      </div>
      <Spin size="large" fix v-if="loading"></Spin>
    </cus-modal>
  </div>
</template>

<script>
import { postPurchasingPlansNone } from "@/api/organ/manager";

const form = {};
export default {
  name: "",
  computed: {},
  data() {
    return {
      loading: false,
      form,
      data: [], //提交Excel效验接口返回提示err
      columns: [
        {
          title: "序号",
          width: 70,
          type: "index",
          align: "center",
        },
        {
          title: "伙食单位",
          key: "unitName",
          align: "center",
        },
        {
          title: "采购周期",
          key: "purchasingDate",
          align: "center",
        }, {
          title: "提交时间",
          key: "lastSubmitTime",
          align: "center",
        },
        {
          title: "审核状态",
          // key: "organAuditState",
          align: "center",
          render: (h, params) => {
            return h("div", [
              h(
                "span",
                {
                  style: {},
                },
                // 机关审核状态0-未提交、1-待审核、2-已审核通过、3-已驳回、4-无需审核
                params.row.organAuditState == 0 ? "未提交" : params.row.organAuditState == 1 ? "待审核" : params.row.organAuditState == 2 ? "已审核通过" : params.row.organAuditState == 3 ? "已驳回" : "无需审核"
              ),
            ]);
          },
        },
      ],
      pages: {
        page: 1,
        pageSize: 10,
        pageTotal: 0,
      },
    };
  },
  mounted() {},
  methods: {
    show(nVew) {
      this.loading = false;
      this.$refs["modal"].show = true;
      this.postPurchasingPlansNoneApi(nVew)
    },
    //Excel报表导入确认事件
    onOk() {
      this.$emit("onOk");
    },
    //Excel报表导入取消事件
    onCancel() {
      this.$refs["modal"].show = false;
    },
    postPurchasingPlansNoneApi(nVew) {
      console.log(nVew)
      this.loading = true;
      return new Promise((resolve) => {
        let obj = {};
        obj.startDate = nVew.dateTime[0]
          ? new Date(nVew.dateTime[0]).Format("yyyy-MM-dd")
          : null;
        obj.stopDate = nVew.dateTime[1]
          ? new Date(nVew.dateTime[1]).Format("yyyy-MM-dd")
          : null;
        obj.currentPage = this.pages.page;
        obj.pageSize = this.pages.pageSize;
        postPurchasingPlansNone(obj).then((res) => {
          this.loading = false;
          if (res.code === 1) {
            this.data = res.data.list;
            this.pages.pageTotal = res.data.total;
            resolve();
          }
        });
      });
    },
  },
  computed: {},
  watch: {},
};
</script>

<style lang="less" scoped>
</style>
